package com.aubrey.threadDemo.lock;

import java.util.Random;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class LockConditionDemo {
	
	
	
	public static void main(String[] args) {
		ConditionOperator conOperator = new ConditionOperator();
		
		new Thread(()->{
			int i = 0;
			while(true) {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				i++;
				conOperator.put("name"+i);
			}
		}).start();
		new Thread(()->{
			while(true) {
				try {
					Thread.sleep(5000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				conOperator.get();
			}
		}).start();
	}

}
